package(
    default_visibility = ["//:__subpackages__"],
)

licenses(["notice"])

cc_library(
    name = "key_derivation_config",
    srcs = ["key_derivation_config.cc"],
    hdrs = ["key_derivation_config.h"],
    include_prefix = "tink/keyderivation",
    visibility = ["//visibility:public"],
    deps = [
        ":keyset_deriver_wrapper",
        "//:registry",
        "//config:tink_fips",
        "//keyderivation/internal:prf_based_deriver_key_manager",
        "//prf:hkdf_prf_key_manager",
        "//util:status",
        "@com_google_absl//absl/memory",
    ],
)

cc_test(
    name = "key_derivation_config_test",
    srcs = ["key_derivation_config_test.cc"],
    deps = [
        ":key_derivation_config",
        ":key_derivation_key_templates",
        ":keyset_deriver",
        "//:aead",
        "//:keyset_handle",
        "//:registry",
        "//aead:aead_config",
        "//aead:aead_key_templates",
        "//aead:aes_gcm_key_manager",
        "//config:global_registry",
        "//prf:prf_key_templates",
        "//proto:tink_cc_proto",
        "//util:statusor",
        "//util:test_matchers",
        "@com_google_absl//absl/memory",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "key_derivation_key_templates",
    srcs = ["key_derivation_key_templates.cc"],
    hdrs = ["key_derivation_key_templates.h"],
    include_prefix = "tink/keyderivation",
    visibility = ["//visibility:public"],
    deps = [
        ":keyset_deriver",
        "//:keyset_handle",
        "//config:global_registry",
        "//keyderivation/internal:prf_based_deriver_key_manager",
        "//proto:prf_based_deriver_cc_proto",
        "//proto:tink_cc_proto",
        "//util:statusor",
    ],
)

cc_test(
    name = "key_derivation_key_templates_test",
    srcs = ["key_derivation_key_templates_test.cc"],
    deps = [
        ":key_derivation_key_templates",
        ":keyset_deriver_wrapper",
        "//:registry",
        "//aead:aead_key_templates",
        "//aead:aes_gcm_key_manager",
        "//keyderivation/internal:prf_based_deriver_key_manager",
        "//prf:hkdf_prf_key_manager",
        "//prf:prf_key_templates",
        "//proto:prf_based_deriver_cc_proto",
        "//proto:tink_cc_proto",
        "//util:statusor",
        "//util:test_matchers",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "keyset_deriver",
    hdrs = ["keyset_deriver.h"],
    include_prefix = "tink/keyderivation",
    visibility = ["//visibility:public"],
    deps = [
        "//:keyset_handle",
        "//util:statusor",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "keyset_deriver_wrapper",
    srcs = ["keyset_deriver_wrapper.cc"],
    hdrs = ["keyset_deriver_wrapper.h"],
    include_prefix = "tink/keyderivation",
    deps = [
        ":keyset_deriver",
        "//:cleartext_keyset_handle",
        "//:keyset_handle",
        "//:primitive_set",
        "//:primitive_wrapper",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings:string_view",
    ],
)

cc_test(
    name = "keyset_deriver_wrapper_test",
    srcs = ["keyset_deriver_wrapper_test.cc"],
    deps = [
        ":keyset_deriver",
        ":keyset_deriver_wrapper",
        "//:cleartext_keyset_handle",
        "//:keyset_handle",
        "//:primitive_set",
        "//proto:tink_cc_proto",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "keyset_deriver_test",
    srcs = ["keyset_deriver_test.cc"],
    deps = [
        ":keyset_deriver",
        ":keyset_deriver_wrapper",
        "//:insecure_secret_key_access",
        "//:key",
        "//:keyset_handle",
        "//:partial_key_access",
        "//:partial_key_access_token",
        "//:registry",
        "//:restricted_data",
        "//aead:aes_gcm_key",
        "//aead:aes_gcm_parameters",
        "//aead:aes_gcm_proto_serialization",
        "//config:global_registry",
        "//internal:mutable_serialization_registry",
        "//internal:proto_parameters_serialization",
        "//internal:serialization",
        "//keyderivation/internal:prf_based_deriver_key_manager",
        "//proto:hkdf_prf_cc_proto",
        "//proto:prf_based_deriver_cc_proto",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:statusor",
        "//util:test_keyset_handle",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_absl//absl/types:optional",
        "@com_google_googletest//:gtest_main",
    ],
)
